#define DEBUG
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long double ld;

const int maxn=200000;
const ld eps=1e-8;

class Ele {
	public:
		ld v;
		int id;

		static bool cmp(Ele &a, Ele &b) {
			return a.v>b.v;
		}
};

bool check(ld c, int n, Ele rank[], int a[], int t[], ld time[][2]) {
	ld bmax=0;
	for (int l=n, r; l>0; l=r) {
		for (r=l; r>0 && a[rank[r].id]==a[rank[l].id]; r--) {
			int o=rank[r].id;
			if (a[o]*(1-c*time[o][1]/time[0][1])<bmax) {
				return false;
			}
		}
		for (int i=r+1; i<=l; i++) {
			int o=rank[i].id;
			bmax = max(bmax, a[o]*(1-c*time[o][0]/time[0][1]));
		}
	}
	return true;
}

int main() {
	freopen("score.in", "r", stdin);
	freopen("score.out", "w", stdout);

	static Ele elea[maxn+1], eleb[maxn+1];
	static int a[maxn+1], t[maxn+1];
	static ld time[maxn+1][2];
	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; i++) scanf("%d", a+i);
	for (int i=1; i<=n; i++) scanf("%d", t+i);
	for (int i=1; i<=n; i++) elea[i].v=(ld)a[i]/t[i], eleb[i].v = a[i], elea[i].id=eleb[i].id = i;

	sort(elea+1, elea+n+1, Ele::cmp);
	sort(eleb+1, eleb+n+1, Ele::cmp);

	ld sumt=0;
	for (int l=1, r; l<=n; l=r) {
		ld temp=0;
		for (r=l; r<=n && elea[r].v==elea[l].v; r++) temp += t[elea[r].id];
		for (int i=l; i<r; i++) {
			time[elea[i].id][0] = sumt+t[elea[i].id];
			time[elea[i].id][1] = sumt+temp;
		}
		sumt += temp;
	}
	time[0][1]=sumt;

	ld ans=0;
	for (ld l=0, r=1, mid; l<=r; ) {
		mid = (l+r)/2;
		if (check(mid, n, eleb, a, t, time)) {
			ans = mid;
			l = mid+eps;
		} else {
			r = mid-eps;
		}
	}

	printf("%.9LF", ans);

	fclose(stdin);
	fclose(stdout);
	return 0;
}
